<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成绩等级</title>
    <script>
        function myfunction() {
            while (1) {
                let score = prompt("请输入成绩");
                if (isNaN(score)) {
                    alert("请输入数字");
                    continue;
                } else if (score > 150 || score < 0) {
                    alert("成绩不合法");
                    continue
                } else {
                    score = parseInt(score);
                    if (score >= 100) {
                        document.write("你的成绩为:" + score + "<br>" + "等级为A")
                    } else {
                        if (score >= 80) {
                            document.write("你的成绩为:" + score + "<br>" + "等级为B")
                        } else {
                            if (score >= 60) {
                                document.write("你的成绩为:" + score + "<br>" + "等级为C")
                            } else {
                                document.write("你的成绩为:" + score + "<br>" + "等级为D")
                            }
                        }
                    }
                }
                break;
            }

        }


        myfunction()
    </script>
</head>
<body>

</body>
</html>